package com.ls.lsqc.common.utils;

public class DataSourceContextHolder {

	// ZY - ERP数据源
	public static final String DATA_SOURCE_ZYSQL = "erpDataSource";
	// ZY - ERP 备份历史记录数据源
	public static final String DATA_SOURCE_ZYSQL_HISTORY = "erpHistoryDataSource";
	// B2B- 数据源
	public static final String DATA_SOURCE_MTMSQL = "mtmDataSource";

	// 用ThreadLocal来设置当前线程使用哪个dataSource
	private static final ThreadLocal<String> contextHolder = new ThreadLocal<String>();

	public static void setDbType(String dbType) {
		contextHolder.set(dbType);
	}

	public static String getDbType() {
		return ((String) contextHolder.get());
	}

	public static void clearDbType() {
		contextHolder.remove();
	}

}
